home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 May
/
EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso
/
softwareupdate
/
system
/
amigados
/
amigadoslibrary
/
info.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-10-10
|
2KB
|
67 lines
/* Info.c V1.0 93-09-27 */
/* ROM library: "dos.library/Info", (All versions) */
/* Copyright 1993, Anders Bjerin, Amiga C Club */
#include <dos/dos.h>
#include <exec/memory.h>
#include <clib/dos_protos.h>
#include <clib/exec_protos.h>
#include <stdio.h>
#include <stdlib.h>
UBYTE *version = "$VER: Info 1.0";
int main( int argc, char *argv[] );
int main( int argc, char *argv[] )
{
BPTR my_lock;
struct InfoData *my_info_data;
LONG ok;
/* Allocate an InfoData structure: */
my_info_data = (struct InfoData *)
AllocMem( sizeof( struct InfoData ), MEMF_ANY );
if( !my_info_data )
{
printf( "Could not allocate enough memory!\n" );
exit( 20 );
}
/* Lock the disk: */
my_lock = Lock( "df0:", SHARED_LOCK );
if( !my_lock )
{
printf( "Could not lock the disk!\n" );
FreeMem( my_info_data, sizeof( struct InfoData ) );
exit( 21 );
}
/* Examine the disk: */
ok = Info( my_lock, my_info_data );
if( !ok )
{
printf( "Could not examine the disk!\n" );
UnLock( my_lock );
FreeMem( (APTR) my_info_data, sizeof( struct InfoData ) );
exit( 22 );
}
/* The unit number: */
printf( "Disk unit number: %d\n", my_info_data->id_UnitNumber );
/* Print some info about the disk: */
if( my_info_data->id_DiskState == ID_WRITE_PROTECTED )
printf( "The disk is Write Protected!\n" );
if( my_info_data->id_DiskState == ID_VALIDATING )
printf( "The disk is being validated!\n" );
if( my_info_data->id_DiskState == ID_VALIDATED )
printf( "The disk is Not (Write) Protected!\n" );
UnLock( my_lock );
FreeMem( my_info_data, sizeof( struct InfoData ) );
exit( 0 );
}